package cn.edu.bjut.homework.chapter6;

import cn.edu.bjut.homework.chapter3.Date;
import cn.edu.bjut.homework.chapter4.Cpc;
import cn.edu.bjut.homework.chapter4.Ipc;
import cn.edu.bjut.homework.chapter5.Patent;

public class ChapterSix {
    public static void main(String[] args) {
        Corpus corpus = new Corpus();
        init(corpus);
        // Print corpus
        System.out.println(corpus.toString());

        // Test search
        System.out.println(corpus.searchPatent(14725838));
        System.out.println(corpus.searchPatent(new Date("2015-07-30")));
        System.out.println(corpus.searchPatent(new Ipc("D04B  1/00")));
        System.out.println(corpus.searchPatent(new Cpc("G06F  3/485", 'L', 'A')));

        // Test delete
        System.out.println(corpus.searchPatent(14725838));
        corpus.deletePatent(14725838);
        System.out.println(corpus.searchPatent(14725838));

    }

    public static void init(Corpus corpus) {
        corpus.add(new Patent(14725838,
                "2015-05-29",
                "A23B  5/04, A23B  5/045",
                "A23B  5/04, A23B  5/45, A23L 15/20",
                'F',
                'I'
        ));
        corpus.add(new Patent(14814205,
                "2015-07-30",
                "A61H 33/00, C01B 33/107, E04B  1/84",
                "A61H 33/6063, A61H 33/6042",
                'F',
                'I'
        ));
        corpus.add(new Patent(15189723,
                "2016-06-22",
                "D04B  1/00",
                "B65H2301/44514, C01B 33/1071, F16F 15/2, H01L 27/14641",
                'L',
                'A'
        ));
        corpus.add(new Patent(14711011,
                "2015-05-13",
                "B32B 17/10, B32B 27/32",
                "G06F  3/485",
                'L',
                'A'
        ));
        corpus.add(new Patent(14515267,
                "2014-10-15",
                "F16F 15/02, G09G  5/34, G06F  3/0485",
                "A01B 15/06, A01B 15/06",
                'L',
                'I'
        ));
    }
}
